<template>
  <text @click="callPhone(phoneNumber)">
    {{ phoneNumber || "" }}
  </text>
</template>

<script>
  export default {
    data() {
      return {};
    },

    computed: {
      phoneNumber() {
        const settings = this.$store.getters.settings;
        let phone = settings.base ? settings.base.phone : "";

        if (
          settings.customer &&
          settings.customer.phoneUsers &&
          settings.customer.phoneUsers.length > 0
        ) {
          phone = settings.customer.phoneUsers[0].phone;
          if (settings.customer.phoneUsers.length >= 2) {
            // 随机取一个电话
            let index = Math.floor(Math.random() * settings.customer.phoneUsers.length);
            phone = settings.customer.phoneUsers[index].phone;
          }
        }
        return phone;
      },
    },

    mounted() {},
  };
</script>

<style lang="scss" scoped></style>
